/**
 * Copyright (c) 2014-2015, Suredy technology Co., Ltd. All rights reserved.
 * @author ZhangMaoren 
 * @since 2015年11月27日
 * @version 0.1
 */
package com.suredy.app.detection.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;


/**
 * @author ZhangMaoren
 * 色度检测
 */
@Entity
@Table(name = "T_DETECTION_COLORIMETRY")
public class ColorimetryEntity extends Detection{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3231305051704763162L;
	
	@Column(name = "StandardSolution")
	private String standardSolution; //标准溶液
	
	@Column(name = "StandardConcentration")
	private Double standardConcentration; //标准浓度
	
	@Column(name = "SampleVolume")
	private Double sampleVolume; //样品体积 ml
	
	@Column(name = "ReferenceSolution") 
	private String referenceSolution; //标准溶液
	
	@Column(name = "Formula")
	private String formula; //计算公式
	
	@Column(name = "FormaulaDescription")
	private String formulaDescription; //公式说明
	
	@OneToMany(mappedBy = "colorimetry", cascade={CascadeType.ALL}, targetEntity = ColorimetryItemEntity.class) 
	@OrderBy("sampleId, consumption")
	private List<ColorimetryItemEntity> items;
	
	
	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getContent()
	 */
	@Override
	public String getDetectionName() {
		return detectionName;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setContent(java.lang.String)
	 */
	@Override
	public void setDetectionName(String detectionName) {
		this.detectionName = detectionName;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getMethod()
	 */
	@Override
	public String getMethod() {
		return method;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setMethod(java.lang.String)
	 */
	@Override
	public void setMethod(String method) {
		this.method = method;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getStandards()
	 */
	@Override
	public String getStandards() {
		return standards;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setStandards(java.lang.String)
	 */
	@Override
	public void setStandards(String standards) {
		this.standards = standards;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getStandardSolution()
	 */
	public String getStandardSolution() {
		return standardSolution;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setStandardSolution(java.lang.String)
	 */
	
	public void setStandardSolution(String standardSolution) {
		this.standardSolution = standardSolution;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#getStandardConcentration()
	 */
	public Double getStandardConcentration() {
		return standardConcentration;
	}

	/* (non-Javadoc)
	 * @see com.suredy.app.detection.entity.Detection#setStandardConcentration(java.lang.Double)
	 */
	public void setStandardConcentration(Double standardConcentration) {
		this.standardConcentration = standardConcentration;
	}

	
	/**
	 * @return the sampleVolume
	 */
	public Double getSampleVolume() {
		return sampleVolume;
	}

	
	/**
	 * @param sampleVolume the sampleVolume to set
	 */
	public void setSampleVolume(Double sampleVolume) {
		this.sampleVolume = sampleVolume;
	}

	
	/**
	 * @return the referenceSolution
	 */
	public String getReferenceSolution() {
		return referenceSolution;
	}

	
	/**
	 * @param referenceSolution the referenceSolution to set
	 */
	public void setReferenceSolution(String referenceSolution) {
		this.referenceSolution = referenceSolution;
	}

	
	/**
	 * @return the formula
	 */
	public String getFormula() {
		return formula;
	}

	
	/**
	 * @param formula the formula to set
	 */
	public void setFormula(String formula) {
		this.formula = formula;
	}

	
	/**
	 * @return the formulaDescription
	 */
	public String getFormulaDescription() {
		return formulaDescription;
	}

	
	/**
	 * @param formulaDescription the formulaDescription to set
	 */
	public void setFormulaDescription(String formulaDescription) {
		this.formulaDescription = formulaDescription;
	}

	
	/**
	 * @return the items
	 */
	public List<ColorimetryItemEntity> getItems() {
		return items;
	}

	
	/**
	 * @param items the items to set
	 */
	public void setItems(List<ColorimetryItemEntity> items) {
		for (ColorimetryItemEntity item : items) {
			if (!this.equals(item.getColorimetry())) {
				item.setColorimetry(this);
			}
		}
		this.items = items;
	}

}
